<?php
/**
 * 活动管理
 *
 *
 *
 */

//use Shopnc\Tpl;

defined('InShopNC') or exit('Access Invalid!');
class activityControl extends mobileHomeControl{

	public function __construct() {
        parent::__construct();
    }

    /**
     * 活动列表
     */
	public function indexOp() {
        $model_activity = Model('activity');
        $condition = array();
        $data = $model_activity->getList($condition);
        output_data(array('activity_list'=>$data));
	}

    /**
     * 活动详情
     */
    public function detailOp() {
        $model_activity_detail = Model('activity_detail');
        $goods=Model('goods');
        $condition = array();

        if(!empty($_GET['activity_id'])) {
            $condition['activity_id'] = $_GET['activity_id'];
        }
        $data = $model_activity_detail->getList($condition);
        for($i=0;$i<count($data);$i++){
            $where['goods_id']=$data[$i]['item_id'];
            $img=$goods->getGoodsInfo($where,'goods_image');
           //$data[$i]['good_pic']= $img['goods_image'];
            $data[$i]['good_pic']=cthumb($img['goods_image'], 360, $data[$i]['store_id']);
        }
        output_data(array('activity_detail_list'=>$data));
    }
}
